home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 6
/
FM Towns Free Software Collection 6.iso
/
t_os
/
fs201q0
/
rs232c.s
< prev
Wrap
Text File
|
1993-07-08
|
2KB
|
114 lines
/*
functions for GNU assembler
by EF-3civic
*/
.globl _RS_GETCH
.globl _RS_PUTCH
.globl _RS_STAT
.globl _RS_CMD
.globl _RS_INIT
/******************************************
RS232C hardware access functions
******************************************/
.data
.text
/*
int RS_GETCH() get byte with wait
*/
.align 4
_RS_GETCH:
movw $0xa02,%dx
L1: movl $0x5,%ecx
LA: loop LA
inb %dx,%al
testb $0x2,%al
jz L1
movl $0x5,%ecx
LB: loop LB
movw $0xa00,%dx
inb %dx,%al
movzbl %al,%eax
movl $0x5,%ecx
LC: loop LC
ret
/*
void RS_PUTCH(int data) put byte with wait
*/
.align 4
_RS_PUTCH:
movw $0xa02,%dx
L2: movl $0x5,%ecx
LD: loop LD
inb %dx,%al
testb $0x1,%al
jz L2
movl $0x5,%ecx
LE: loop LE
movw $0xa00,%dx
movb 4(%esp),%al
outb %al,%dx
movl $0x5,%ecx
LF: loop LF
ret
/*
int RS_STAT() read RS status
*/
.align 4
_RS_STAT:
movw $0xa02,%dx
inb %dx,%al
movzbl %al,%eax
movl $0x5,%ecx
LG: loop LG
ret
/*
void RS_CMD(int data) set RS command
*/
.align 4
_RS_CMD:
movw $0xa02,%dx
movb 4(%esp),%al
outb %al,%dx
movl $0x5,%ecx
LH: loop LH
ret
/*
void RS_INIT() initialize
*/
.align 4
_RS_INIT:
xorb %al,%al
movw $0xa08,%dx
outb %al,%dx
movl $0x5,%ecx
LI: loop LI
movw $0xa02,%dx
outb %al,%dx
movl $0x100,%ecx
LJ: loop LJ
outb %al,%dx
movl $0x100,%ecx
LK: loop LK
outb %al,%dx
movl $0x100,%ecx
LL: loop LL
movb $0x40,%al
outb %al,%dx
movl $0x100,%ecx
LM: loop LM
movb $0x4e,%al
outb %al,%dx
movl $0x100,%ecx
LN: loop LN
movb $0x37,%al
outb %al,%dx
movl $0x5,%ecx
LO: loop LO
ret